
<template>
    <div>
        <template v-for="(item, index) in options">
            <template v-if="values.includes(item.dictValue)">
                <span v-if="item.listClass == 'default' || item.listClass == ''" :key="item.dictValue"
                    :class="item.cssClass" :index="index">{{ item.dictLabel }}</span>
                <el-tag v-else :key="item.dictValue" :class="item.cssClass" :disable-transitions="true" :index="index"
                    :type="item.listClass == 'primary' ? '' : item.listClass">
                    {{ item.dictLabel }}
                </el-tag>
            </template>
        </template>
    </div>
</template>

<script setup lang="ts">
const props = defineProps({
    options: Array,
    value: [Number, String, Array],
});
const values = computed(() => {
    if (props.value !== null && typeof props.value !== 'undefined') {
        return Array.isArray(props.value) ? props.value : [String(props.value)];
    } else {
        return [];
    }
});
</script>

<style lang="scss" scoped>
.el-tag+.el-tag {
    margin-left: 10px;
}
</style>